package com.antcloud.demo.antscheduler.handlers;

import java.util.concurrent.ThreadPoolExecutor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alipay.antschedulerclient.common.ClientCommonResult;
import com.alipay.antschedulerclient.handler.ISimpleJobHandler;
import com.alipay.antschedulerclient.model.JobExecuteContext;

public class RetryThreeTimesHandler implements ISimpleJobHandler {

    private final Logger LOGGER = LoggerFactory.getLogger(getClass());

    @Override
    public String getName() {
        return "retryThreeTimesHandler";
    }

    @Override
    public ClientCommonResult handle(JobExecuteContext context) {
        LOGGER.info("[RetryThreeTimesHandler] handle retry three times job");
        if (SuccessUtil.isSucess(50)) {
            return ClientCommonResult.buildSuccessResult();
        }
        return ClientCommonResult.buildFailResult("handle failed");
    }

    @Override
    public ThreadPoolExecutor getThreadPool() {
        return null;
    }
}
